<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .p{
            font-size: 50px;
            font-weight: bold;
        }
        .btn{
            padding: 20px;
        }
    </style>
</head>
<body>
    <p class="p"></p>
    <button class="btn">返回</button>

    <script>
        var search = location.search;
        var news = ["军事", "美食", "经济", "动画", "其他"];
        var p = document.querySelector('.p');
        var btn = document.querySelector('.btn');
        //对传来的值进行处理
        var arr = search.slice(1).split('&');
        var arr2 = [];
        for (var i = 0; i < arr.length; i++) {
            arr2 = arr[i].split('=');
            if (arr2[0] === 'title') {
                p.innerText = '当前类型为：' + news[arr2[1]];
            }
        }
        // 点击按钮返回
        btn.onclick = function () {
            history.go(-1)
        }
    </script>
</body>
</html>